﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace client
{
    public partial class LedGroupControl : UserControl
    {
        private string group = "";
        public string Group
        {
            get { return group; }
            set
            {
                group = value;
                label1.Text = string.Format("Group: {0}", group);
            }
        }

        public LedGroupControl()
        {
            InitializeComponent();

            textBox1.FineStep = 1;
            textBox1.CourseStep = 10;
            textBox1.Width = label1.GetPreferredSize(new Size(0, 0)).Width;
            
            MinimumSize = new Size(textBox1.Width, textBox1.Bottom);
            MaximumSize = new Size(textBox1.Width, textBox1.Bottom);
        }

        private void label1_Resize(object sender, EventArgs e)
        {
        }

        private void label1_TextChanged(object sender, EventArgs e)
        {
            textBox1.Width = label1.GetPreferredSize(new Size(0,0)).Width;

            MinimumSize = new Size(textBox1.Width, textBox1.Bottom);
            MaximumSize = new Size(textBox1.Width, textBox1.Bottom);
        }

        private void textBox1_TextUpdate(object sender, double value)
        {
            LedChannelControl.UpdateGroup(Group, value);
        }
    }
}
